
package com.cqrcb.cloud.controller;

import com.cqrcb.cloud.entity.activity.Activity;
import com.cqrcb.cloud.entity.activity.io.ActivityIO;
import com.cqrcb.cloud.entity.api.req.Q;
import com.cqrcb.cloud.entity.api.res.R;
import com.cqrcb.cloud.service.activity.ActivityService;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.cqrcb.cloud.config.annotation.*;

import java.util.List;

/**
 * @author yangxueyong
 */
@Slf4j
@Api("活动接口")
@RestController
public class ActivityController {

	@Autowired
	private ActivityService activityService;

	@CustomLogAnnotation
	@PostMapping("/echo")
	public String echo() {
		log.info("被调用-->1");
		activityService.queryActivityById("xxx1");
		return "provider-";
	}

	@CustomValidation
	@CustomLogAnnotation
	@PostMapping("/getByPage")
	@ApiOperation(value = "查询活动", notes = "查询活动")
	@ApiImplicitParam(name = "活动入参", value = "活动入参", required = true, dataType = "ActivityIO")
	public R<PageInfo<Activity>> getByPage(@RequestBody Q<ActivityIO> activityIO) {
		log.info("被调用-->1");
		R<PageInfo<Activity>> pageInfoR = activityService.queryActivityByPage(activityIO);
		return pageInfoR;
	}

//	public static void main(String[] args) {
////		R.data()
//	}
}
